/**
 * Copyright 2015 jianglibo@gmail.com
 *
 */
package com.m3958.logcollector.datacommons.exception;

import java.util.HashMap;
import java.util.Map;

/**
 * an ajax error formatter
 * {
 *   "errors": {
 *     "username": ["This username is already taken!"],
 *     "email": ["Doesn't look like a valid email."]
 *   }
 * }
 * 
 * @author jianglibo@gmail.com
 *         2015年12月17日
 *
 */
public class ErrorsToClient {
    
    private Map<String, String[]> errors = new HashMap<>();
    
    public ErrorsToClient() {}
    
    public ErrorsToClient addError(String name, String...messages) {
        getErrors().put(name, messages);
        return this;
    }
    

    public Map<String, String[]> getErrors() {
        return errors;
    }

    public void setErrors(Map<String, String[]> errors) {
        this.errors = errors;
    }
}
